<template>
  <div class="touch_action">
    <ylheader :leftsvg="true" :title="'活动详情'"></ylheader>
    <pull-to-refresh :disablePulldown="true" :disablePullup="true" class="comment-page" style="height:12.4rem;">
      <hottopicdetail id="topicdetailtopic" :topicimg="pushobj.pushCoverMap" :abbreviations="pushobj.pushTitle" :followNumber="pushobj.followNumber" :title="pushobj.pushTitle" :pushTime="pushobj.pushTime" :topictype="2"></hottopicdetail>
      <div id="topicDetailHtml" v-on:click="clickImage($event)" v-html="html" class="htmlstyle"></div>
      <p style="padding-bottom:1.2rem;"></p>
    </pull-to-refresh>
    
    <div v-show="pushobj.type!='0'">
        <div  @click="godetail"> <img src="~img/qianwang.png" alt="" class="my-tabbar"></div>
        <div class="qianwang"  @click="godetail" >前往</div>
    </div>
  </div>
</template>
<script>
import ylheader from "src/components/yl-header.vue";
import hottopicdetail from "src/components/topic/hot-topic-detail.vue";
import api from "src/api/index";
import PullToRefresh from 'src/components/pull-to-refresh'
export default {
  name:"activityrecommendationdetail",
  data() {
    return {
      pushobj: {type:0},
      html:"",//推送内容
    };
  },
  mounted() {
    this.getPushDetail().then(res=>{
      this.$nextTick(() => {
        setTimeout(() => {
            this.$bus.$emit('scrollRefresh');
        }, 500);
      });
    });
  },
  methods: {
    getPushDetail() {
        let p = new Promise((resolve, reject) => {
          let pushId = this.pushId;
          if (typeof this.pushId == "undefined") {
            pushId = this.$route.query.pushId;
          }
          api.getpushdetail({ id:pushId }).then(res => {
            if (res.success) {
              this.pushobj = res.push;
              this.html = res.push.pushContent;
            }
             resolve("获取推送内容....");
           });
        });
        return p;
    },
    godetail(){
      switch (this.pushobj.type){
        case 1:
              this.$router.push({
                path: "/topicdetail",
                query: { topicId: this.pushobj.jumpId}
              });
        break;
        case 2:
          this.$router.push({
            path: "/shuodetail",
            query: { saysId: this.pushobj.jumpId,shuoshuoIndex:0}
          });
        break;
        case 3:
          this.$router.push({
            path: "/replacedetail",
            query: { replacedId: this.pushobj.jumpId,replacedResult:0,replaceIndex:0}
          });
        break;
        default:
        break;
      }
    }
  },
  components: {
    ylheader,
    hottopicdetail,
    PullToRefresh
  }
};
</script>
<style scoped>
  .htmlstyle{
    font-size: 0.28rem;
    color:#3a3a3a;
    background-color: white;
    padding: 0.25rem 0.52rem;
    word-wrap:break-word;
    word-break:break-all;
    line-height:0.52rem
  }
  .my-tabbar{
		width: 0.9rem;
		height: 0.9rem;
		color:#fff;
		text-align:center;
		position: fixed;
		right: 0.3rem;
		bottom: 0.4rem
	}
  .qianwang{
    font-size: 0.28rem;
    font-family: PingFangSC Medium;
    text-align:center;
		position: fixed;
		right: 0.47rem;
		bottom: 0.7rem;
    color: #ffffff;
  }


</style>